Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: QuickTime

Previous | Overview | Contents | Next |

Undo for Tracks

The Movie Toolbox provides functions that allow you to capture and restore the edit state of a track. As with the functions that manipulate a movie's edit state, you can manage a track's edit states in order to implement an undo capability for track editing. For example, you can capture a track's edit state before performing an editing operation, such as a cut, and later restore the old state. You can have several track edit states obtained at different times during an editing session, and you can restore to any one of them at any time. In this manner, you can provide a multilevel undo capability. This section describes the Movie Toolbox functions that work with track edit states.

Note that a track's edit state does not save everything about the track. Most important, the edit state does not contain information about track spatial characteristics. For example, the edit state does not store the current clipping region. Consequently, edit states are best suited to supporting undo operations involving track content. You can use other Movie Toolbox functions to support undo operations for track characteristics. See "Functions That Modify Movie Properties," which begins on Functions That Modify Movie Properties , to learn more about these functions.

You can use the NewTrackEditState function to capture a track's edit state. Use the UseTrackEditState function to restore the track to its condition according to a previous edit state. Your application can dispose of an edit state by calling the DisposeTrackEditState function.

NewTrackEditState

You can create an edit state by calling the NewTrackEditState function. This function creates an edit state that contains all the information describing a track's content, including the identity of the media data associated with the track and all the track's edit lists.

Note
You must dispose of a movie's track edit states before disposing of the track or of the movie that contains the track. Use the DisposeTrackEditState function, which is described on DisposeTrackEditState , to dispose of an edit state.

pascal TrackEditState NewTrackEditState (Track theTrack);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

DESCRIPTION

The NewTrackEditState function returns a track edit state identifier. You can use this identifier with other Movie Toolbox edit state functions, such as UseTrackEditState (described in the next section). If this function could not create the edit state, it sets this returned identifier to nil .

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

Memory Manager errors

UseTrackEditState

Your application can use the UseTrackEditState function to return a track to its condition according to an edit state you created previously.

pascal OSErr UseTrackEditState (Track theTrack,
                                         TrackEditState state);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

state
Specifies the edit state for this operation. Your application obtains this edit state identifier when you create the edit state by calling the NewTrackEditState function, which is described in the previous section.

DESCRIPTION

The UseTrackEditState function uses the information stored in the edit state to update the track's contents. This may change the contents of some of the track. Consequently, the time characteristics of the movie that contains the track, especially the duration, may change as a result of restoring the saved edit state. Your application creates an edit state by calling the NewTrackEditState function.

SPECIAL CONSIDERATIONS

You can use the UseTrackEditState function only with tracks that currently belong to a movie. A track may be detached from its movie as a result of edit processing--you cannot use this function with such a track.

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

invalidEditState

-2023

This edit state is invalid

nonMatchingEditState

-2024

This edit state is not valid for this movie

DisposeTrackEditState

The DisposeTrackEditState function disposes of a track edit state. Your application must dispose of any edit states you create. You create an edit state by calling the NewTrackEditState function, which is discussed on NewTrackEditState .

Note
You must dispose of a movie's track edit states before you dispose of the track or the movie.

pascal OSErr DisposeTrackEditState (TrackEditState state);
state
Specifies the edit state for this operation. Your application obtains this edit state identifier when you create the edit state by calling the NewTrackEditState function (described on NewTrackEditState ).

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

invalidEditState

-2023

This edit state is invalid

staleEditState

-2025

Movie or track has been disposed


© 1999 Apple Computer, Inc.

Previous | Overview | Contents | Next